[Data]
life = 1050
attack = 100
defence = 100
fall.defence_up = 50
liedown.time = 20
airjuggle = 25
sparkno = S6001
guard.sparkno = -1
KO.echo = 0
volume = 0
IntPersistIndex = 0
FloatPersistIndex = 0

[Size]
xscale = 1
yscale = 1
ground.back = 13
ground.front = 13
air.back = 12
air.front = 12
height = 28
attack.dist = 80
proj.attack.dist = 80
proj.doscale = 2
head.pos = 6, -48
mid.pos = 3, -30
shadowoffset = 0
draw.offset = 0,0

[Velocity]
walk.fwd  = 1.85
walk.back = -1.67
run.fwd  = 3.8,-3.2
run.back = -3.2,-3
jump.neu = 0,-6.8
jump.back = -1.8
jump.fwd = 2
runjump.back = -1.3,-8.1
runjump.fwd = 1.4,-8.1
airjump.neu = 0
airjump.back = 0
airjump.fwd = 0

[Movement]
airjump.num = 0
airjump.height = 0
yaccel = .44
stand.friction = .85
crouch.friction = .82

[Quotes]
victory1 = "They don't call me a champion for nothing."
victory2 = "Here's a Clu, you stink at fighting!"
victory3 = "Come at me again and I'll crush your bones to powder!"
victory4 = "Eww, you kind of smell like sewage now..."
victory5 = "These fists are prepared for anything!"
victory6 = "Hey! Can I get another chance? Please?"
victory7 = "I see how it is, you're nothing but fish food!"
victory8 = "I hope his brother's around, the sewers could use a cleaning!"
victory9 = "This is reminding me of some good times..."
victory10 = "I like a tough one... want to fight with me instead?"
victory11 = "If you're made for fighting, why was it so easy to make you into scrap?"
victory12 = "I see it doesn't take much to knock you into holes!"
victory13 = "Hey, a proper fight! That was actually fun!"
;---------------------------------------------------------------------------
;Var List

;***Universal***
;var(0) = Command variable
;var(1) = Famicom Fighters character detection
;var(2) = First hit counter
;var(3) = Helper select
;var(4) = Victory quote variable
;var(5) = Juggle Count
;var(6) = Helper health
;var(7) = Helper meter
;var(8) = Pause variable
;var(9) = Special move combo condition
;var(10) = Command Detection
;var(20) = Detection for first hit of multi-hit/multi-state moves
;var(21) = Test Var
;var(22) = Identification Variable
;var(23) = Counter for Training Mode Detection
;var(24) = Training Mode Var	  
;var(25) = Death State Check
;var(27) = Test Var
;var(28) = Super Finish
;var(30) = Hide helper bars and move names
;var(31) = Max helper health
;var(32) = Countdown for helper select
;var(33) = Back Charge
;var(34) = Back Charge Ready
;var(35) = Down Charge
;var(36) = Down Charge Ready
;var(37) = Projectile Ready
;var(38) = Helper Ready
;var(39) = Helper Projectile Ready
;var(40) = Air Guard Option
;var(41) = Air Recovery Option
;var(42) = Helpers Option
;var(43) = Pause Option 
;var(44) = Control Scheme
;var(45) = Standalone Helper Bar (X-Position)
;var(46) = Standalone Helper Bar (Y-Position)
;var(47) = Standalone Helper Bar (BG)
;var(48) = Alt Victory Music
;var(50) = Reaction var
;var(51) = Tag team var
;var(52) = Projectile animation var
;var(53) = Assist check
;var(54) = Hyper Tag-In check
;var(55) = AI switch check
;var(58) = Special move command time var
;var(59) = AI Var
;fvar(0) = Helper bars scaling
;fvar(20) = Damage scaling, current power
;fvar(21) = Damage scaling, future power
;fvar(24) = Test Var
;fvar(30) = Special projectile Vel X
;fvar(31) = Special projectile Vel Y
;fvar(32) = Super projectile Vel X
;fvar(33) = Super projectile Vel Y
;fvar(34) = Helper projectile Vel X
;fvar(35) = Helper projectile Vel Y
;fvar(36) = Helper Vel X
;fvar(37) = Helper Vel Y

;***Specific***
;var(11) = EX Counter Attack Hit
;var(12) = Randomizer variable for the fish
;var(13) = Super armor hit counter (Unused, meant for standalone version)
;var(14) = Super armor timer (Unused, meant for standalone version)
;var(15) = Wind-Up counter (Unused, meant for standalone version)
;var(16) = Fish var
;var(17) = Flowerpot var
;var(19) = Intro var
;var(48) = Special Intro Var (Unused, meant for standalone version)
;var(49) = 2010 Mode Option (Unused, meant for standalone version)
;***Helpers***
;---------------------------------------------------------------------------
; Lose by Time Over
[Statedef 170]
type = S
ctrl = 0
anim = 170
velset = 0,0

[State 170, 1]
type = NotHitBy
trigger1 = 1
value = SCA
time = 1

[State 170, 2]
type = PosAdd
triggerall = Time > 25
trigger1 = AnimElemTime(2) = 0
x = -32*const(size.xscale)

[State 170, 3]
type = PosAdd
trigger1 = AnimElemTime(3) = 0
x = -48*const(size.xscale)

[State 170, 4]
type = ScreenBound
trigger1 = 1
value = 0

[State 170, 5]
type = PlaySnd
trigger1 = AnimElem = 2
value = S11,1
;---------------------------------------------------------------------------
; Win state decider
[Statedef 180]
type = S

[State 180, 1]
type = ChangeState
trigger1 = (!MatchOver) && (!Time)
value = 181+8*(enemy,Name = "Bonus" && enemy,Var(0) = 0 && enemy,Var(5) = 0)

[State 180, 2]
type = ChangeState
trigger1 = (MatchOver) && (!Time)
value = 182+7*(enemy,Name = "Bonus" && enemy,Var(0) = 0 && enemy,Var(5) = 0)

;---------------------------------------------------------------------------
; Win pose 1 - Bow
[Statedef 181]
type = S
ctrl = 0
anim = 180
velset = 0,0

[State 0, PlaySnd]
type = PlaySnd
trigger1 = AnimElem = 4
value = S0,0

[State 0, PlaySnd]
type = PlaySnd
trigger1 = AnimElem = 5
value = S180,0
;---------------------------------------------------------------------------
; Win pose 1 - Bow
[Statedef 182]
type = S
ctrl = 0
anim = 181
velset = 0,0

[State 182, 1]
type = AssertSpecial
trigger1 = Time < ((575 * (PalNo < 4)) + (367 * (PalNo = 4)) + (176 * (PalNo = 5)) + (348 * (PalNo = 6)))
flag = roundnotover

[State 182, 1]
type = AssertSpecial
trigger1 = 1
flag = nomusic

[State 0, ChangeAnim]
type = ChangeAnim
trigger1 = Time >= ((517 * (PalNo < 4)) + (309 * (PalNo = 4)) + (118 * (PalNo = 5)) + (290 * (PalNo = 6)))
value = 181
elem = AnimElemNo(0)

[State 182, 4]
type = PlaySnd
triggerall = !NumPartner
trigger1 = !Time
value = S181,Cond(PalNo < 4,0,PalNo-1)

[State 182, 5]
type = PlaySnd
triggerall = NumPartner
trigger1 = (ID = 56 || ID = 58) && !Time 
trigger2 = (ID = 57 || ID = 59) && partner,Alive = 0 && !Time
value = S181,Cond(PalNo < 4,0,PalNo-1)


;---------------------------------------------------------------------------
; PREINTRO
[Statedef 190]
type = S
ctrl = 0
velset = 0,0
sprpriority = 5

[State 190, 1] ;Go straight to intro.
type = ChangeState
triggerall = !NumPartner
trigger1 = Time = 0
value = 191+(3*Var(48))

[State 190, 2] ;Go straight to intro.
type = ChangeState
triggerall = NumPartner
triggerall = ID = 56 || ID = 58
trigger1 = Time = 0
value = 191

[State 190, 3] ;Go straight to intro.
type = ChangeState
triggerall = NumPartner
triggerall = ID = 57 || ID = 59
trigger1 = Time = 0
value = 195

;---------------------------------------------------------------------------
; Introduction
[Statedef 191]
type = S
ctrl = 0
anim = 20
velset = 0,0
sprpriority = 2

[State 191, 1]
type = VarRandom
trigger1 = !Time
v = 19
range = 0,2 

[State 191, 2]
type = Null
triggerall = enemy,name = "Urban Champion"
trigger1 = Time = 1
var(19) = 0

[State 191, 3]
type = AssertSpecial
trigger1 = 1
flag = Intro

[State 191, 4]
type = AssertSpecial
trigger1 = Time < 90
flag = invisible

[State 191, 5]
type = Null
trigger1 = 1
value = 0
ignorehitpause = 1

[State 0, Explod]
type = Explod
trigger1 = Time = 1
anim = 20
ID = 190
pos = -168,0
postype = p1
facing = 1
vfacing = 1
bindtime = 1
vel = 1.9*const(size.xscale),0
removetime = 89
scale = 1,1
sprpriority = 2
shadow = -1

[State 191, 6]
type = Null
trigger1 = Time = 1
x = (((ScreenPos X)+78) * - 1)*const(size.xscale)

[State 191, 7]
type = Null
trigger1 = Time = 1
x = 1.9*const(size.xscale)
y = 0

[State 191, 8]
type = Null
trigger1 = (Anim = 20) && Time && !(Time % 16) && (Time % 32)
value = S20,1

[State 191, 9]
type = Null
trigger1 =  (Anim = 20) && Time && !(Time % 32)
value = S20,0

[State 191, 10]
type = Null
trigger1 =  (Anim = 20) && (Time = 89)
x = 0

;++++++++++++++++++++++++++++++++++++++
;Normal Intro
[State 191, Intro 1 (1)]
type = ChangeAnim
trigger1 = (!Var(19)) && (Time = 90)
value = 190

[State 191, Intro 1 (2)]
type = Null
trigger1 = (!Var(19)) && (Time = 90)
x = (-70-(25*(Cond(NumPartner,(ID > partner,ID),0))))*(Facing)

[State 191, Intro 1 (3)]
type = PlaySnd
trigger1 = (!Var(19)) && (Anim = 190) && AnimElem = 4
					   
value = S0,0
channel = 1

[State 191, Intro 1, (4)]
type = ChangeState
trigger1 = (Var(19) = 0) && (Time = 114)
value = 0
;++++++++++++++++++++++++++++++++++++++++
;Police Car Intro
[State 191, Intro 2 (1)]
type = ChangeAnim 
trigger1 = (Var(19) = 1) && (Time = 90)
value = 191

[State 191, Intro 2 (2)]
type = Null
trigger1 = (Var(19) = 1) && (Time = 90)
x = (-70-(25*(Cond(NumPartner,(ID > partner,ID),0))))*(Facing)

[State 191, Intro 2 (3)]
type = Explod
trigger1 =  Var(19) = 1 && Time = 90
anim = 900
ID = 192
pos = -215,241
postype = back
facing = 1
vfacing = 1
bindtime = 1
vel = 2.15,0
removetime = 351
scale = const(size.xscale),const(size.yscale)
sprpriority = 6
ontop = 0
ownpal = 1

[State 191, Intro 2 (4)]
type = PlaySnd
trigger1 = (Var(19) = 1) && (Time = 90)
value = S192,0
channel = 1

[State 191, Intro 2 (5)]
type = ChangeState
trigger1 = (Var(19) = 1) && (Time = 537)
value = 0
;++++++++++++++++++++++++++++++++++++++++
;Flower Pot Intro
[State 191, Intro 3 (1)]
type = ChangeAnim 
trigger1 = (Time = 90) && (Var(19) = 2)
value = 190

[State 191, Intro 3 (1)]
type = ChangeAnim 
trigger1 = Cond(NumHelper(192),helper(192),StateNo = 193,0) && (Var(19) = 2)
value = 192

[State 191, Intro 3 (2)]
type = Null
trigger1 = (Var(19) = 2) && (Time = 90) && (Anim = 190 || AnimElem = 192) && AnimElem = 1
x = (-70-(25*(Cond(NumPartner,(ID > partner,ID),0))))*(Facing)

[State 191, Intro 3 (3)]
type = Helper
trigger1 = (Var(19) = 2) && (Time = 46)
name = "Flower Pot"
ID = 192
stateno = 192
pos = 0,ceil((floor(ScreenPos Y)*-1)*const(size.xscale))
postype = p1    
facing = 1
keyctrl = 0
ownpal = 1
size.xscale = const(size.xscale)
size.yscale = const(size.yscale)

[State 191, Intro 3 (6)]
type = ChangeAnim
trigger1 = (Var(19) = 2) && Anim = 192 && !AnimTime
value = 196

[State 191, Intro 3 (7)]
type = ChangeAnim
trigger1 = (Var(19) = 2) && Anim = 196 && !AnimTime
value = 193

[State 191, Intro 3 (8)]
type = PlaySnd
trigger1 = (Var(19) = 2) && (Time = 46)
value = S193,0
channel = 1

[State 191, Intro 3 (9)]
type = PlaySnd
trigger1 = (Var(19) = 2) && Cond(NumHelper(192),helper(192),StateNo = 193,0)
value = S193,1
channel = 1
persistent = 0

[State 191,, Intro 3 (11)]
type = ChangeState
trigger1 = (Var(19) = 2) && Anim = 193 && !AnimTime
value = 0
;---------------------------------------------------------------------------
;Flower Pot
[Statedef 192]
type = A
movetype = I
physics = N
ctrl = 0
anim = 901
velset = 0,3.12*floor(const(size.yscale))
sprpriority = 3

[State 192, 1]
type = ChangeState
trigger1 = Pos Y >= (parent,const(size.head.pos.y) - 10)*floor(const(size.yscale))
value = 193
ctrl = 0
;---------------------------------------------------------------------------
;Flower Pot (break)
[Statedef 193]
type = A
movetype = I
physics = N
ctrl = 0
anim = 902
velset = 0,0
sprpriority = 3

[State 193, 1]
type = PosAdd
trigger1 = !Time
y = 1*const(size.yscale)

[State 193, 2]
type = DestroySelf
trigger1 = !AnimTime
;---------------------------------------------------------------------------
; Introduction
[Statedef 194]
type = S
ctrl = 0
anim = 194
velset = 0,0
sprpriority = 2

[State 191, 1]
type = AssertSpecial
trigger1 = 1
flag = Intro

[State 191, 2]
type = Helper
trigger1 = Time = 44
name = "Flower Pot"
ID = 192
stateno = 192
pos = 92,(floor(ScreenPos Y)*-1)
postype = back    
facing = 1
keyctrl = 0
ownpal = 1
size.xscale = const(size.xscale)
size.yscale = const(size.yscale)

[State 191, Intro 3 (1)]
type = ChangeAnim 
trigger1 = Cond(NumHelper(192),helper(192),StateNo = 193,0)
value = 197

[State 0, PlaySnd]
type = PlaySnd
trigger1 = Anim = 194 && (AnimElem = 8 || AnimElem = 10)
value = S195,0

[State 191, Intro 3 (8)]
type = PlaySnd
trigger1 = Time = 44
value = S193,0
channel = 1

[State 191, Intro 3 (9)]
type = PlaySnd
trigger1 = Cond(NumHelper(192),helper(192),StateNo = 193,0)
value = S193,1
channel = 1
persistent = 0

[State 191,, Intro 3 (11)]
type = ChangeState
trigger1 = !AnimTime
value = 0

;---------------------------------------------------------------------------
; Taunt
[Statedef 195]
type = S
movetype = I
physics = S
ctrl = 0
anim = 195
velset = 0,0
sprpriority = 2

[State 195, 1]
type = PlaySnd
trigger1 = AnimElem = 5 || AnimElem = 8 || AnimElem = 11
value = S195,0

[State 195, 2]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
ctrl = 1
;========================<EXPLODSIVE BUFFERING HELPER>=============================
[StateDef 90000005]
type = A
physics = N
moveType = I
anim = 1
velSet = 0,0
ctrl = 0
     
[State 90000005, DisplayToClipboard]
type = DisplayToClipboard
trigger1 = 1
text = "by JustMorphPointman"
ignoreHitPause = 1
;---------------------------------------------------------------------------
; Override common states (use same number to override) :
;---------------------------------------------------------------------------
;---------------------------------------------------------------------------
; Stand
[Statedef 0]
type = S
physics = S
sprpriority = 0

[State 0, 1]
type = ChangeAnim
trigger1 = (Anim != 0 && Anim != 2) && Anim != 5
trigger2 = Anim = 5 && AnimTime = 0
trigger3 = Anim = 2 && P2BodyDist X < 150
trigger4 = Anim = 0 && P2BodyDist X >= 150
value = Cond(P2BodyDist X >= 150, 2, 0)

[State 0, 2]
type = VelSet
trigger1 = Time = 0
y = 0

[State 0, 3] ;Stop moving if low velocity or 4 ticks pass
type = VelSet
trigger1 = abs(vel x) < 2
trigger2 = Time = 4
x = 0

[State 0, 6] ;Are you dead?
type = ChangeState
trigger1 = !alive
value = 5050	
;---------------------------------------------------------------------------												
; Jump Start
[Statedef 40]
type    = S
physics = S
anim = 40
ctrl = 0
sprpriority = 1

[State 40]
Type= ChangeState
Triggerall= !Time
Triggerall= var(59) > 0
triggerall = !(P2MoveType = H && P2StateType = A) && !((enemynear(0),Pos Y < -55.1))
triggerall = fvar(30) <= 0 && fvar(32) <= 0 && fvar(34) <= 0 
triggerall = abs(P2BodyDist X > 39.6)
trigger1 = random < var(50)*3
value= 0
ctrl= 1

[State 40, 1]
type = VarSet
trigger1 = Time = 0
sysvar(1) = 0

[State 40, 2]
type = VarSet
trigger1 = command = "holdfwd"
trigger1 = var(59)=0
trigger2 = var(59)>0
trigger2 = (P2MoveType = H && P2StateType = A) && (enemynear(0),Pos Y < -55.1);(P2MoveType = H && P2StateType = A) && enemynear(0),Pos Y < -70
trigger3 = var(59)>0
trigger3 = (abs(enemy,fvar(30) < 58.4) && (enemy,fvar(30) > 0)) || (abs(enemy,fvar(32) < 58.4) && (enemy,fvar(32) > 0)) || (abs(enemy,fvar(34) < 58.4) && (enemy,fvar(34) > 0))
trigger3 = (abs(enemy,fvar(31) > -42.6) && !(enemy,fvar(31) = 0)) || (abs(enemy,fvar(33) > -42.6) && !(enemy,fvar(33) = 0))|| (abs(enemy,fvar(35) > -42.6) && !(enemy,fvar(35) = 0))
trigger4 = var(59)>0
trigger4 = random<var(50)*3.6
sysvar(1) = 1

[State 40, 3]
type = VarSet
trigger1 = command = "holdback"
trigger1 = var(59)=0
sysvar(1) = -1

[State 0, ChangeAnim]
type = Null
trigger1 = sysvar(1) = -1 && Anim != 5
value = 5

[State 40, 4]
type = VelSet
trigger1 = AnimTime = 0
x = ifelse(sysvar(1)=0, const(velocity.jump.neu.x), ifelse(sysvar(1)=1, const(velocity.jump.fwd.x), const(velocity.jump.back.x)))
y = const(velocity.jump.y)

[State 40, 5]
type = VelSet
trigger1 = AnimTime = 0
trigger1 = prevstateno = 100 ;RUN_FWD
trigger1 = sysvar(1) = 1
x = const(velocity.runjump.fwd.x)

[State 40, 6]
type = NotHitBy
trigger1 = 1
value = ,AT
time = 1

[State 40, 7]
type = ChangeState
trigger1 = AnimTime = 0
value = 50
ctrl = 1
;---------------------------------------------------------------------------
; HIT_LIEDOWN
[Statedef 5110]
type    = L
movetype= H
physics = N

[State 5110, EnvShake]
type = FallEnvShake
trigger1 = Time = 0

[State 5110, 1] ;For hit up/up-diag type (from state 5081)
type = ChangeAnim
persistent = 0
trigger1 = SelfAnimExist(5110 + (anim % 10))
trigger1 = anim = [5081,5089]
value = 5110 + (anim % 10)

[State 5110, 2] ;Hit ground anim (normal)
type = ChangeAnim
triggerall = time = 0
triggerall = anim != [5110,5119] ;Not already changed anim
trigger1 = anim != [5161,5169]
trigger2 = !SelfAnimExist(5170 + (anim % 10))
value = 5170

[State 5110, 3] ;Hit ground anim (for hit up)
type = ChangeAnim
triggerall = time = 0
triggerall = anim != [5110,5119] ;Not already changed anim
trigger1 = anim = [5161,5169]
trigger1 = SelfAnimExist(5170 + (anim % 10))
value = 5170 + (anim % 10)

[State 5110, 4]
type = HitFallDamage
trigger1 = Time = 0

[State 5110, 5]
type = PosSet
trigger1 = Time = 0
y = 0

[State 5110, Var] ;Get fall velocity
type = VarSet
trigger1 = Time = 0
trigger1 = GetHitVar(fall.yvel) != 0
sysvar(1) = floor(vel y)

[State 5110, 6]
type = PlaySnd
triggerall = Life > 0
trigger1 = Time = 0
trigger1 = !SysVar(0)
value = F7, (sysvar(1) > 5) + (sysvar(1) > 14)

[State 5110, 7]
type = GameMakeAnim
triggerall = Life > 0
trigger1 = Time = 0
trigger1 = !SysVar(0)
value = 60 + (sysvar(1) > 5) + (sysvar(1) > 14)
pos = 0, 0
under = sysvar(1) <= 14

[State 5110, 8]
type = VelSet
trigger1 = Time = 0
y = 0

[State 5110, 9] ;For hit up type
type = ChangeAnim
persistent = 0
triggerall = anim = [5171,5179]
triggerall = SelfAnimExist(5110 + (anim % 10))
trigger1 = AnimTime = 0
trigger2 = SysVar(0) ;SysVar(0) = 1 avoids hit ground anim
value = 5110 + (anim % 10)

[State 5110, 10] ;For normal
type = ChangeAnim
persistent = 0
triggerall = Anim != [5111,5119]
trigger1 = AnimTime = 0
trigger2 = SysVar(0) ;SysVar(0) = 1 avoids hit ground frame
value = 5110

[State 5110, 11] ;If just died
type = SelfState
triggerall = !alive
trigger1 = AnimTime = 0
trigger2 = SysVar(0) ;SysVar(0) = 1 avoids hit ground frame
trigger3 = Anim = [5110,5119]
value = 5150

[State 5110, 12]
type = VarSet
trigger1 = SysVar(0)
trigger1 = Time = 0
sysvar(0) = 0

[State 5110, 13] ;Friction
type = VelMul
trigger1 = 1
x = 0.85

[State 5110, 14]
type = ForceFeedback
trigger1 = alive
trigger1 = Time = 0
time = 8
ampl = 240
waveform = sine

[State 5110, 15]
type = ForceFeedback
trigger1 = !alive
trigger1 = Time = 0
ampl = 200, 7, -.467
time = 30
waveform = sine

[State 5110, 16]
type = PosSet
triggerall = Life = 0
trigger1 = Time = 0
y = 2

[State 5110, 17]
type = PlaySnd
triggerall = Life = 0
trigger1 = Time = 0
value = S3100,0

;---------------------------------------------------------------------------
; HIT_LIEDEAD
[Statedef 5150]
type    = L
movetype= H
physics = N
velset = 0
sprpriority = -3

[State 5150, 1] ;Match over anim
type = ChangeAnim
trigger1 = Time = 0
trigger2 = Anim = 5150 && AnimElem = 3
value = 5150

[State 5150, 2]
type = NotHitBy
trigger1 = 1
value = SCA
time = 1

[State 5150, 3]
type = AssertSpecial
trigger1 = PrevStateNo = 5400
flag = noshadow

[State 5150, 4]
type = VelSet
trigger1 =  PrevStateNo = 5400
x = 0
y = 0

[State 5150, 5]
type = ScreenBound
triggerall = Anim = 5150
trigger1 = 1
value = 0
ignorehitpause = 1

[State 5150, 6]
type = PosAdd
triggerall = Time > 10 && Name = "Urban Champion"
triggerall = Anim = 5150
trigger1 = AnimElemTime(1) = 0
x = -32*const(size.xscale)

[State 5150, 7]
type = PosAdd
triggerall = Anim = 5150 && Name = "Urban Champion"
trigger1 = AnimElemTime(2) = 0
x = -48*const(size.xscale)
;---------------------------------------------------------------------------
; HITA_UP (initial going up)
[Statedef 25030]
type    = A
movetype= H
physics = N
ctrl = 0

[State 25030, 1]
type = VelAdd;Gravity
trigger1 = 1
y = GetHitVar(yaccel)

[State 25030, 2]
type = HitVelSet
trigger1 = Time = 0
x = 1
y = 1

[State 25030, 3]
type = ChangeState
trigger1 = HitOver
trigger2 = Vel Y > 0    ;Hit ground
trigger2 = Pos Y >= 10  ;.
value = 25050 ;HITA_FALL

[State 25030, 4]
type = ChangeState
trigger1 = AnimTime = 0
value = 25035 ;HITA_UP (transition)

[State 25030, 5]
type = ChangeAnim
trigger1 = Time = 0
value = 5030

;DIZZY STATE FOR BEING HIT WITH FLOWER POT IN AIR---------------------------------------------------------------------------
; HITA_UP_T (transition)
[Statedef 25035]
type    = A
movetype= H
physics = N

[State 25035, 1]
type = ChangeAnim
trigger1 = Time = 0
trigger1 = SelfAnimExist(5035)
trigger1 = Anim != [5051,5059] ;Not if in hit up anim
trigger1 = Anim != 5090 ;Not if hit off ground anim
value = 5035

[State 25035, 2]
type = VelAdd
trigger1 = 1
y = GetHitVar(yaccel)

[State 25035, 3]
type = ChangeState 
trigger1 = HitOver  ;Hit is over
trigger2 = AnimTime = 0 ;Anim is over
trigger3 = Vel Y > 0    ;Hit ground
trigger3 = Pos Y >= 10  ;.
trigger4 = Time = 0     ;No transition anim
trigger4 = Anim != 5035 ;.
value = 25050 ;HITA_FALL
;---------------------------------------------------------------------------
; HITA_FALL (knocked up, falling)
[Statedef 25050]
type    = A
movetype= H
physics = N

[State 25050, 1] ;Change anim when done with transition
type = ChangeAnim
trigger1 = AnimTime = 0
trigger1 = Anim = 5035
trigger2 = Time = 0     ;If no transition anim
trigger2 = Anim != 5035
trigger2 = (Anim != [5051, 5059]) && (Anim != [5061, 5069])
trigger2 = Anim != 5090 ;Not if hit off ground anim
value = 5050

[State 25050, 2] ;Coming down anim
type = ChangeAnim
trigger1 = anim = [5050,5059]
trigger1 = Vel Y >= ifelse(anim = 5050, 1, -2)
trigger1 = SelfAnimExist(anim+10)
value = anim+10
persistent = 0

[State 25050, 3] ;Gravity
type = VelAdd
trigger1 = 1
y = GetHitVar(yaccel)

[State 25050, 4]
type = ChangeState
trigger1 = Vel Y > 0
trigger1 = Pos Y >= ifelse((anim = [5051,5059]) || (anim = [5061,5069]), 0, 25)
value = 25100 ;HIT_BOUNCE
;---------------------------------------------------------------------------
; HIT_BOUNCE (hit ground)
[Statedef 25100]
type    = L
movetype= H
physics = N

[State 25100, 1]
type = VelSet
trigger1 = Time = 0
trigger1 = GetHitVar(fall.yvel) = 0
trigger1 = vel x > 1
x = 1

[State 225100, EnvShake]
type = FallEnvShake
trigger1 = Time = 0

[State 25100, Var] ;Save fall velocity
type = VarSet
trigger1 = Time = 0
sysvar(1) = floor(vel y)

[State 25100, 2] ;Hit ground anim (normal)
type = ChangeAnim
triggerall = time = 0
trigger1 = (anim != [5051,5059]) && (anim != [5061,5069])
trigger2 = !SelfAnimExist(5100 + (anim % 10))
value = 5100

[State 25100, 3] ;Hit ground anim (for hit up)
type = ChangeAnim
trigger1 = time = 0
trigger1 = (anim = [5051,5059]) || (anim = [5061,5069])
trigger1 = SelfAnimExist(5100 + (anim % 10))
value = 5100 + (anim % 10)

[State 25100, 4]
type = PosSet
trigger1 = Time = 0
y = 0

[State 25100, 5]
type = VelSet
trigger1 = Time = 0
y = 0

[State 25100, 6] ;Reduce speed
type = VelMul
trigger1 = Time = 0
x = 0.75

[State 25100, 7]
type = ChangeState
trigger1 = Time = 0
trigger1 = GetHitVar(fall.yvel) = 0
value = 25110 ;HIT_LIEDOWN

[State 25100, 8]
type = GameMakeAnim
trigger1 = Time = 1
value = 60 + (sysvar(1) > 5) + (sysvar(1) > 14)
pos = 0, 0
under = sysvar(1) <= 14

[State 25100, 9]
type = HitFallDamage
trigger1 = Time = 3

[State 25100, 10]
type = PlaySnd
trigger1 = Time = 1
value = F7, (sysvar(1) > 5) + (sysvar(1) > 14)

[State 25100, 11]
type = PosFreeze
trigger1 = 1

[State 25100, 12]
type = ChangeState
trigger1 = AnimTime = 0
value = 25101

[State 25100, 13]
type = ForceFeedback
trigger1 = Time = 0
waveform = sinesquare
ampl = 128,-3,-.2,.005
time = 20

;---------------------------------------------------------------------------
; HIT_BOUNCE (bounce into air)
[Statedef 25101]
type    = L
movetype= H
physics = N

[State 25101, 1] ;Coming hit ground anim (normal)
type = ChangeAnim
triggerall = time = 0
trigger1 = anim != [5101,5109]
trigger2 = !SelfAnimExist(5160 + (anim % 10))
value = 5160

[State 25101, 2] ;Coming hit ground anim (for hit up)
type = ChangeAnim
triggerall = time = 0
trigger1 = anim = [5101,5109]
trigger1 = SelfAnimExist(5160 + (anim % 10))
value = 5160 + (anim % 10)

[State 25101, 3]
type = HitFallVel
trigger1 = Time = 0

[State 25101, 4]
type = PosSet
trigger1 = Time = 0
y = 20

[State 25101, 5] ;Acceleration
type = VelAdd
trigger1 = 1
y = .4

[State 25101, 6] ;Hit ground
trigger1 = Vel Y > 0
trigger1 = Pos Y >= 12
type = ChangeState
value = 25110

;---------------------------------------------------------------------------
; HIT_LIEDOWN
[Statedef 25110]
type    = L
movetype= H
physics = N

[State 25110, EnvShake]
type = FallEnvShake
trigger1 = Time = 0

[State 25110, 1] ;For hit up/up-diag type (from state 5081)
type = ChangeAnim
persistent = 0
trigger1 = SelfAnimExist(5110 + (anim % 10))
trigger1 = anim = [5081,5089]
value = 5110 + (anim % 10)

[State 25110, 2] ;Hit ground anim (normal)
type = ChangeAnim
triggerall = time = 0
triggerall = anim != [5110,5119] ;Not already changed anim
trigger1 = anim != [5161,5169]
trigger2 = !SelfAnimExist(5170 + (anim % 10))
value = 5170

[State 25110, 3] ;Hit ground anim (for hit up)
type = ChangeAnim
triggerall = time = 0
triggerall = anim != [5110,5119] ;Not already changed anim
trigger1 = anim = [5161,5169]
trigger1 = SelfAnimExist(5170 + (anim % 10))
value = 5170 + (anim % 10)

[State 25110, 4]
type = HitFallDamage
trigger1 = Time = 0

[State 25110, 5]
type = PosSet
trigger1 = Time = 0
y = 0

[State 25110, Var] ;Get fall velocity
type = VarSet
trigger1 = Time = 0
trigger1 = GetHitVar(fall.yvel) != 0
sysvar(1) = floor(vel y)

[State 25110, 6]
type = PlaySnd
trigger1 = Time = 0
trigger1 = !SysVar(0)
value = F7, (sysvar(1) > 5) + (sysvar(1) > 14)

[State 25110, 7]
type = GameMakeAnim
trigger1 = Time = 0
trigger1 = !SysVar(0)
value = 60 + (sysvar(1) > 5) + (sysvar(1) > 14)
pos = 0, 0
under = sysvar(1) <= 14

[State 25110, 8]
type = VelSet
trigger1 = Time = 0
y = 0

[State 25110, 9] ;For hit up type
type = ChangeAnim
persistent = 0
triggerall = anim = [5171,5179]
triggerall = SelfAnimExist(5110 + (anim % 10))
trigger1 = AnimTime = 0
trigger2 = SysVar(0) ;SysVar(0) = 1 avoids hit ground anim
value = 5110 + (anim % 10)

[State 25110, 10] ;For normal
type = ChangeAnim
persistent = 0
triggerall = Anim != [5111,5119]
trigger1 = AnimTime = 0
trigger2 = SysVar(0) ;SysVar(0) = 1 avoids hit ground frame
value = 5110

[State 25110, 11] ;If just died
type = SelfState
triggerall = !alive
trigger1 = AnimTime = 0
trigger2 = SysVar(0) ;SysVar(0) = 1 avoids hit ground frame
trigger3 = Anim = [5110,5119]
value = 5150

[State 25110, 12]
type = VarSet
trigger1 = SysVar(0)
trigger1 = Time = 0
sysvar(0) = 0

[State 25110, 13] ;Friction
type = VelMul
trigger1 = 1
x = 0.85

[State 25110, 14]
type = ForceFeedback
trigger1 = alive
trigger1 = Time = 0
time = 8
ampl = 240
waveform = sine

[State 25110, 15]
type = ForceFeedback
trigger1 = !alive
trigger1 = Time = 0
ampl = 200, 7, -.467
time = 30
waveform = sine

[State 25110, 16]
type = ChangeState
trigger1 = Time = 35
value = 25120
;---------------------------------------------------------------------------
; HIT_GETUP
[Statedef 25120]
type    = L
movetype= I
physics = N

[State 25120, 1a] ;Get up anim (normal)
type = ChangeAnim
triggerall = time = 0
trigger1 = anim != [5111,5119]
trigger2 = !SelfAnimExist(5120 + (anim % 10))
value = 5120

[State 25120, 1b] ;Get up anim (for hit up/diag-up)
type = ChangeAnim
triggerall = time = 0
trigger1 = anim = [5111,5119]
trigger1 = SelfAnimExist(5120 + (anim % 10))
value = 5120 + (anim % 10)

[State 25120, 2]
type = VelSet
trigger1 = Time = 0
x = 0

[State 25120, 3]
type = NotHitBy
trigger1 = 1
value = SCA
time = 1

[State 25120, 4]
type = HitFallSet
trigger1 = AnimTime = 0
value = 0

[State 25120, 5] ;Can't be thrown right after getting up
type = NotHitBy
trigger1 = AnimTime = 0
value = , NT,ST,HT
time = 7

[State 25120, 6] ;Can't be hit right after getting up (short time)
type = NotHitBy
trigger1 = AnimTime = 0
value2 = SCA
time = 1

[State 25120, 7]
type = ChangeState
trigger1 = AnimTime = 0
value = 3056
